package com.wxg.demo.controller.rest;

import com.wxg.demo.csdn1.model.User;
import org.springframework.web.bind.annotation.*;

/**
 * 2020年3月8日10:31:54
 * 参考： https://blog.csdn.net/weixin_44914784/article/details/89299496
 */
@RestController
public class RESTFulController {

    @GetMapping("/boot/user/{id}")
    public Object user(@PathVariable("id") Integer id) {
        User user = new User();
        user.setUserId(id);
        user.setUserName("ZS");
        user.setUserPass("123");
        return user;
    }

    @GetMapping("/boot/user/{id}/{name}")
    public Object user(@PathVariable("id") Integer id, @PathVariable("name") String name) {
        User user=new User();
        user.setUserId(id);
        user.setUserName(name);
        user.setUserPass("456");
        return user;
    }

    @PostMapping("/boot/user/add")
    public Object userAdd(@RequestBody User user) {
        System.out.println(user);
        return user;
    }


}
